//package com.cgly.medical.handler.security;
//
//
//import com.cgly.medical.util.Msg;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.web.AuthenticationEntryPoint;
//import org.springframework.stereotype.Component;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * @program: medical
// * @description: 未登录处理器
// * @author: chen di
// * @create: 2022-08-15 16:24
// */
//@Component
//public class CustomizeAuthenticationEntryPoint implements AuthenticationEntryPoint {
//    /**
//     * 使用此处理器返回前端json数据，提示用户未登录或登录失效
//     *
//     * @param request
//     * @param response
//     * @param authException
//     * @throws IOException
//     * @throws ServletException
//     */
//    @Override
//    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
//        System.out.println("无凭证");
//        response.setContentType("text/json;charset=utf-8");
//        response.getWriter().write(new ObjectMapper().writeValueAsString(Msg.fail().mess("用户未登录或登录失效").code(10006)));
//    }
//}